package accs.model.io;

import java.io.BufferedWriter;
import java.io.IOException;
import java.io.Writer;
import java.util.List;

import accs.model.UserPasswordPair;
import accs.model.ebay.EbayAccount;
import accs.model.mail.MailCheckResult;
import accs.model.packstation.PackstationAccount;
import accs.model.paypal.PayPalAccount;
import accs.model.zalando.ZalandoAccount;

public class SimpleUserPasswordWriter {
	private BufferedWriter writer;
	
	public SimpleUserPasswordWriter(Writer writer) {
		this.writer=new BufferedWriter(writer);
	}
	
	public void write(PayPalAccount acc) throws IOException {
		writer.write("| "+acc.getEmail()+" | "+acc.getPassword()+" | "+acc.getName()+" | "+acc.getLast_login()+" | "+acc.getAmount()+" | "+acc.getStatus()+" | "+acc.getKontotyp()+" | "+acc.getKarte()+" | "+acc.getSonstiges()+" |");
		writer.newLine();
	}
	
	public void write(PayPalAccount acc, String emailStatus) throws IOException{
		writer.write("| "+acc.getEmail()+" | "+acc.getPassword()+" | "+acc.getName()+" | "+acc.getLast_login()+" | "+acc.getAmount()+" | "+acc.getStatus()+" | "+acc.getKontotyp()+" | "+acc.getKarte()+" | "+acc.getSonstiges()+" | "+emailStatus+" |");
		writer.newLine();
	}
	
//	public void write(List<UserPasswordPair> list) throws IOException {
//		for(UserPasswordPair pair : list) {
//			write(pair);
//		}
//	}
	
	public void close() throws IOException {
		writer.close();
	}
	
	public void flush() throws IOException {
		writer.flush();
	}

	public void write(PackstationAccount acc, String emailStatus) throws IOException {
		writer.write("| "+acc.getEmail()+" | "+acc.getPassword()+" | "+acc.getPostnr()+" | "+acc.getName()+" | "+acc.getTelnumber()+" | "+acc.getSonstiges()+" | "+emailStatus+" |");
		writer.newLine();		
	}

	public void write(ZalandoAccount acc, String emailStatus) throws IOException {
		writer.write("| "+acc.getEmail()+" | "+acc.getPassword()+" | "+acc.getCountOrders()+" | "+acc.getPaymentMethod()+" | "+emailStatus+" |");
		writer.newLine();	
	}

	public void write(EbayAccount acc, String emailStatus) throws IOException {
		writer.write("| "+acc.getEmail()+" | "+acc.getPassword()+" | "+acc.getFeedbacklist()+" | "+acc.getMembersince()+" | "+acc.getLastfeedback()+" | "+acc.getLimits()+" | "+acc.getFeedback()+" | "+acc.getNextwatching()+" | "+emailStatus+" |");
		writer.newLine();
	}

	public void write(String username, String password, MailCheckResult mcr) throws IOException {
		writer.write("| "+username+" | "+password+" | "+mcr+" |");
		writer.newLine();
		
	}}